package com.ty.day4;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/9 16:32
 */
public class Seven {
    public static void main(String[] args) {
        int[] a = new int[10];
        int sum = 0;
        for (int i = 0; i < a.length; i++) {
            a[i] = (int) (Math.random() * 20);
            if (a[i] % 2 != 0 && a[i] % 3 != 0) {
                sum += a[i];
            }
        }
        System.out.println(Arrays.toString(a));
        System.out.println(sum);
        System.out.println("请输入数将数组填满：");
        int[] arr = new int[5];
        Scanner sc = new Scanner(System.in);
        int x,k=0;
        while (true){
            x=sc.nextInt();
            if (x%5!=0){
                continue;
            }
            arr[k++]=x;
            if (k==5){
                break;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
